﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDMX_Common = SDMX_ML.Framework.Common;

namespace SDMX_ML.Framework.Structure
{
    /// <summary>
    /// CategoryType.
    /// </summary>
    public class CategoryType
    {
        private string _uri;
        private bool? _isExternalReference;
        private SDMX_Common.IDType _id;
        private string _version;
        private string _urn;
        private List<SDMX_Common.TextType> _name;
        private List<SDMX_Common.TextType> _description;
        private List<DataflowRefType> _dataFlowRef;
        private List<MetadataflowRefType> _metadataFlowRef;
        private List<CategoryType> _category;
        private SDMX_Common.AnnotationsType _annotations;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="id">ID.</param>
        public CategoryType(SDMX_Common.TextType name, SDMX_Common.IDType id)
        {
            if (name != null & id != null)
            {
                _name = new List<SDMX_Common.TextType>();
                _description = new List<SDMX_Common.TextType>();
                _dataFlowRef = new List<DataflowRefType>();
                _metadataFlowRef = new List<MetadataflowRefType>();
                _category = new List<CategoryType>();

                _name.Add(name);
                _id = id;
            }
            else
            {
                throw new Exception("Element Name and attribute id are required in CategoryType.");
            }

        }
        //Elements
        
        /// <summary>
        /// Name.
        /// </summary>
        public List<SDMX_Common.TextType> Name
        {
            get { return _name; }
            set { _name = value; }
        }
        
        /// <summary>
        /// Description.
        /// </summary>
        public List<SDMX_Common.TextType> Description
        {
            get { return _description; }
            set { _description = value; }
        }
        
        /// <summary>
        /// DataflowRef.
        /// </summary>
        public List<DataflowRefType> DataFlowRef
        {
            get { return _dataFlowRef; }
            set { _dataFlowRef = value; }
        }
        
        /// <summary>
        /// MetadataFlowRef.
        /// </summary>
        public List<MetadataflowRefType> MetadataFlowRef
        {
            get { return _metadataFlowRef; }
            set { _metadataFlowRef = value; }
        }
        
        /// <summary>
        /// Category.
        /// </summary>
        public List<CategoryType> Category
        {
            get { return _category; }
            set { _category = value; }
        }
        
        /// <summary>
        /// Annotations.
        /// </summary>
        public SDMX_Common.AnnotationsType Annotations
        {
            get { return _annotations; }
            set { _annotations = value; }
        }

        //Attributes
        
        /// <summary>
        /// ID.
        /// </summary>
        public SDMX_Common.IDType ID
        {
            get { return _id; }
            set { _id = value; }
        }
        
        /// <summary>
        /// Version.
        /// </summary>
        public string Version
        {
            get { return _version; }
            set { _version = value; }
        }
        
        /// <summary>
        /// URN.
        /// </summary>
        public string URN
        {
            get { return _urn; }
            set { _urn = value; }
        }
        
        public string URI
        {
            get { return _uri; }
            set { _uri = value; }
        }
        
        /// <summary>
        /// IsExternalReference.
        /// </summary>
        public bool? IsExternalReference
        {
            get { return _isExternalReference; }
            set { _isExternalReference = value; }
        }

    }
}
